package com.fbee.smartcommunities.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fbee.smartcommunities.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fbee.smartcommunities.vo.LoginVO;
import com.sun.org.apache.xpath.internal.operations.Bool;
import io.minio.errors.*;
import org.springframework.web.multipart.MultipartFile;

import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author 汪佳泉
 * @since 2024-08-16
 */
public interface UserService extends IService<User> {

    Boolean add(String name,
                String nickname,
                LocalDate birthday,
                String phone,
                String email,
                String address,
                String password,
                Integer state,
                Integer roleId,
                MultipartFile file) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException;

    Boolean fixState(Long id,Boolean state);

    Page<User> getTargetList(Integer pageNo, Integer pageSize, String keyword,Integer roleId);

    /**
     * 校验字段是否重复
     * @param column
     * @param value
     * @return
     */
    Boolean check(String column,String value,Integer id);

    Boolean update(Integer id,
                   String name,
                   String nickNameString,
                   LocalDate birthday,
                   String phone,
                   String email,
                   String address,
                   MultipartFile file,
                   String icon) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException;

    LoginVO login(String username , String password ,String type,HttpServletRequest request);

    Boolean getCaptcha(String to,String state) throws MessagingException;

    Boolean fixPassword(String username,String password,String code);

    List<User> getUsersByNoticeTitle(String title);

    String getCode(String to);

    Boolean registration(String email,String password,String code,Integer role);

    Boolean transfer(Long from,Long to,Double count,HttpServletRequest request,String content);

    String completeInformation(Integer openId,
                        String name,
                        String nickName,
                        LocalDate birthday,
                        String phone,
                        String address,
                        MultipartFile file,String icon) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException;

    Boolean checkNull(Long uid);

    Boolean recharge(Double count,Long openId,HttpServletRequest request);
}
